package com.ts.tsavplayer.player

import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.Surface
import android.view.SurfaceHolder
import android.view.SurfaceView
import androidx.resourceinspection.annotation.Attribute
import java.io.File

class VideoPlayerSurfaceView:SurfaceView, SurfaceHolder.Callback {

    var mAVPlayer:AVPlayer?=null
    var surface:Surface?= null

    constructor(context:Context,att: AttributeSet):super(context,att){
        holder.addCallback(this)
        mAVPlayer=AVPlayer()
    }

    override fun surfaceCreated(holder: SurfaceHolder) {
        surface=holder.surface
        var file = File("/sdcard/midway.mp4")
        if (file.exists()){
            Log.e(TAG,"exists")
        }
//        mAVPlayer?.play("/sdcard/input.avi",holder.surface)
    }
    private  val TAG = "VideoPlayerSurfaceView"

    override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {

    }

    override fun surfaceDestroyed(holder: SurfaceHolder) {

    }





}